ToAnnObject(DicomDataSet,List<DicomAnnotationObject>) Method

Summary
Converts a list of Leadtools.Dicom.DicomAnnotationObject into a list of Leadtools.Annotations.Engine.AnnObject objects.
Syntax
C#
C++/CLI
public: 
List<AnnObject^>^ ToAnnObject(  
   DicomDataSet^ ds, 
   List<DicomAnnotationObject^>^ dicomAnnotationObjectList 
)  

Parameters

ds
A Leadtools.Dicom.DicomDataSet that contains the Graphic Group Sequence (0070,0234).

dicomAnnotationObjectList
The a list of list of Leadtools.Dicom.DicomAnnotationObject to be converted.

Return Value

A list of Leadtools.Annotations.Engine.AnnObject

Remarks

This function converts a list of DICOM Annotation Objects (text, graphic, and compound graphic) Leadtools.Dicom.DicomAnnotationObject into a list of LEAD annotation objects (Leadtools.Annotations.Engine.AnnObject).

Note that dicomAnnotationObjectList can contain Leadtools.Dicom.DicomAnnotationObject that are grouped together, to return a single Leadtools.Annotations.Engine.AnnObject.

For example, the Leadtools.Annotations.Engine.AnnPolyRulerObject, Leadtools.Annotations.Engine.AnnProtractorObject, and the Leadtools.Annotations.Engine.AnnCrossProductObject are all stored as one or more 'grouped' Leadtools.Dicom.DicomCompoundGraphic objects.

Example

This example does the following:

  1. Creates two grouped rulers (Leadtools.Dicom.DicomCompoundGraphic)
  2. Creates a converter
  3. Converts the grouped rulers to a LEAD Leadtools.Annotations.Engine.AnnPolyRulerObject
C#
using Leadtools; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Annotations; 
using Leadtools.Annotations; 
using Leadtools.Annotations.Engine; 
 
private List<AnnObject> DicomAnnotationsUtilities_ToAnnObject2() 
{ 
   // Set up the DicomAnnotationsUtilities converter 
   DicomAnnotationsUtilities du = new DicomAnnotationsUtilities(); 
   du.ImageDpiX = 96.0; 
   du.ImageDpiY = 96.0; 
   du.DisplayWidth = 200; 
   du.DisplayHeight = 200; 
   du.LayerName = "Layer 0"; 
   du.CompoundGraphicInstanceId = 100; 
   du.GraphicGroupId = 123; 
 
   // LineStyle -- user for both rulers 
   DicomLineStyle lineStyle = new DicomLineStyle(); 
   lineStyle = new DicomLineStyle(); 
   lineStyle.LineOptions = DicomAnnotationLineOptions.None; 
   lineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off; 
   lineStyle.Shadow.ShadowOpacity = 0.0f; 
   lineStyle.Shadow.ShadowOffsetX = 0.0f; 
   lineStyle.Shadow.ShadowOffsetY = 0.0f; 
   lineStyle.Shadow.ShadowColorCieLabValue = new ushort[3] { 1, 2, 3 }; 
 
   lineStyle.PatternOnColorCieLabValue = new ushort[3] { 24886, 53484, 50171 };   // red 
   lineStyle.PatternOffColorCieLabValue = new ushort[3] { 0, 0, 0 }; 
   lineStyle.LineThickness = 2.0f; 
   lineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid; 
   lineStyle.LinePattern = 0xFFFF; 
   lineStyle.PatternOnOpacity = 1.0f; 
   lineStyle.PatternOffOpacity = 0.0f; 
 
   // Create a compound graphic -- ruler0 
   DicomCompoundGraphic ruler0 = new DicomCompoundGraphic(); 
 
   ruler0.LayerName = "Layer 0"; 
   ruler0.Units = DicomAnnotationUnitsRelativityType.Pixel; 
   ruler0.Type = DicomAnnotationCompoundGraphicType.Ruler; 
 
   DicomAnnotationPoint[] pts = new DicomAnnotationPoint[2]; 
   pts[0] = new DicomAnnotationPoint(100, 100); 
   pts[1] = new DicomAnnotationPoint(200, 200); 
   ruler0.SetAnnotationPoints(pts, pts.Length); 
 
   ruler0.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId(); 
   ruler0.GraphicGroupId = du.GraphicGroupId; 
   ruler0.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId; 
   ruler0.LineStyle = lineStyle.Clone(); 
 
   // Create a compound graphic -- ruler0 
   DicomCompoundGraphic ruler1 = new DicomCompoundGraphic(); 
 
   ruler1.LayerName = "Layer 0"; 
   ruler1.Units = DicomAnnotationUnitsRelativityType.Pixel; 
   ruler1.Type = DicomAnnotationCompoundGraphicType.Ruler; 
 
   pts = new DicomAnnotationPoint[2]; 
   pts[0] = new DicomAnnotationPoint(200, 200); 
   pts[1] = new DicomAnnotationPoint(300, 100); 
   ruler1.SetAnnotationPoints(pts, pts.Length); 
 
   ruler1.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId(); 
   ruler1.GraphicGroupId = du.GraphicGroupId; 
   ruler1.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId; 
   ruler1.LineStyle = lineStyle.Clone(); 
 
   // Convert the DICOM Annotation to a LEAD annotation 
   List<DicomAnnotationObject> listDicomObjects = new List<DicomAnnotationObject>(); 
   listDicomObjects.Add(ruler0); 
   listDicomObjects.Add(ruler1); 
 
   // Create the DicomDataSet that has the GraphicGroupSequence 
   DicomDataSet dsPre = new DicomDataSet(); 
   DicomElement graphicGroupSequenceElement = dsPre.InsertElement(null, false, DicomTag.GraphicGroupSequence, DicomVRType.SQ, true, 0); 
   DicomElement item = dsPre.InsertElement(graphicGroupSequenceElement, true, DicomTag.Item, DicomVRType.SQ, true, 0); 
   dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupLabel, "PolyRulerObject"); 
   dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicLayerDescription, "LEAD Annotation"); 
   dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupID, du.GraphicGroupId); 
 
   List<AnnObject> annObjectList = du.ToAnnObject(dsPre, listDicomObjects); 
   return annObjectList; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Annotations Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.